<?php 
$this->Html->styleBlock("
	div.gallery a.highslide { display: block; width: 186px; height: 186px; padding: 5px; margin: 3px;  border: solid 2px #eee; background-position: center; background-repeat: no-repeat; float: left; overflow: hidden;}
	div.gallery a.highslide:hover { padding: 5px; margin: 3px;  }
",array('inline'=>false));
?>

<div class="content">
	<div id="left-column">
		<?php echo $this->element('left_column')?>		
	</div>
	
	<div class="right-store-column search-bg">
		<?php echo $this->element('search_more',array('plugin'=>'store'))?>
	</div>
	
	<div class="right-store-column">
		<div  class="storeProducts">
		<h2><?php echo __d("store","Your billing and delivery details",true)?></h2>	
		
		<table width="100%" class="custommer-diteils">
			<tr>
				<th width="20%">&nbsp;</th>
				<th width="40%"><?php echo __('Billing details',true)?></th>
				<th width="40%"><?php echo __('Delivery details',true)?></th>
			</tr>		
			<tr>
				<td width="20%"><?php echo __('First Name',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["name"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_name"];?></td>
			</tr>
			<tr>
				<td width="20%"><?php echo __('Last Name',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["surname"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_surname"];?></td>
			</tr>
			<tr>
				<td width="20%"><?php echo __('Address',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["address1"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_address1"];?></td>
			</tr>
			<tr>
				<td width="20%"><?php echo __('Address',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["address2"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_address2"];?></td>
			</tr>
			<tr>
				<td width="20%"><?php echo __('City',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["address3"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_address3"];?></td>
			</tr>
			<tr>
				<td width="20%"><?php echo __('Zip Code',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["address4"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_address4"];?></td>
			</tr>
			<tr>
				<td width="20%"><?php echo __('Country',true)?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["address5"]?></td>
				<td width="40%"><?php echo $buer['Customer'][0]["delivery_address5"];?></td>
			</tr>
		</table>
		
		<h2><?php __d("store","Your Basket Contents")?></h2>	
		
		<?php
		 
		if(isset($products) && is_array($products)){?>	
			<?php echo $this->Form->create('StoreProduct',array('url'=>$strPurchaseURL));?>			
			<table class="index">
				<tr>
					<th colspan="2">
						<?php echo __d('store','Name',true)?>
					</th>
					<th colspan="2">
						<?php echo __d('store','Quantity',true)?>
					</th>
					<th>
						<?php echo __d('store','Price',true)?>
					</th>
					<th>
						<?php echo __d('store','Value',true)?>
					</th>
					
				</tr>
				<?php
				
				$i=0;
				$sum = 0.00;
				$ilosc_typow = 0;
				$style_class = null;
				
				foreach ($products as $item):
					$style_class = null;
					if ($i++ % 2 == 0) {
						$style_class = ' class="altrow"';
					}
					$ilosc_typow = $item['StoreProduct']['amount'];
				?>
				<tr<?php echo $style_class;?>>
					<td width="5%">
						<?php echo $this->Html->link($fileUpload->image($item['StoreUpload']['name'],array('autoResize'=>true,'width'=>40,'imagePathOnly'=>false))
							, array('plugin'=>'store','controller'=>'products','action' => 'view', $item['StoreProduct']['id']),array('escape'=>false,'title'=>$item['StoreProduct']['name'])); ?>&nbsp;
					</td>
					<td width="20%">
						<?php echo $this->Html->link($item['StoreProduct']['name'], array('plugin'=>'store','controller'=>'products','action' => 'view', $item['StoreProduct']['id']),array('escape'=>false)); ?><br/>
				
					</td>
					<td width="3%" valign="middle">
						<?php echo $item['StoreProduct']['amount']; ?>	
					</td>	
					<td width="27%">						
							<table class="index">
								<?php 
								if(isset($item['StoreType']) && is_array($item['StoreType'])){
								foreach ($item['StoreType']as $type) {?>
								<tr>
									<td>
									<?php echo $type['name'];?>
									</td>
									<td>
									 <?php echo (!empty($type['group'])) ? $type['group'] : '';?>
									</td>									
								</tr>	
								<?php }}	?>
							</table>							
					</td>
					<td  width="20%" align="right">
						<?php if($item['StoreProduct']['price_przecena'] > 0 && $item['StoreProduct']['price_promocja'] == 0){?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($item['StoreProduct']['price_detaliczna'],2,'','',$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange']);?></span> 
								<span class="product-view-price"><?php echo $this->Store->price($item['StoreProduct']['price_przecena'],2,null,null,$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange'])?></span>
						<?php }else if( $item['StoreProduct']['price_promocja'] > 0){?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($item['StoreProduct']['price_detaliczna'],2,'','',$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange']);?></span> 
								<span class="product-view-price"><?php echo $this->Store->price($item['StoreProduct']['price_promocja'],2,null,null,$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange'])?></span>
						<?php }else{?>
								<span class="product-view-price"><?php echo $this->Store->price($item['StoreProduct']['price_detaliczna'],2,null,null,$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange'])?></span>
						<?php }?>
					</td>
					<td  width="20%" align="right">
						<?php if($item['StoreProduct']['price_przecena'] > 0 && $item['StoreProduct']['price_promocja'] == 0){?>
								<?php
									$price = str_replace(',', '.', $item['StoreProduct']['price_przecena']) * $ilosc_typow;	
									$price_detal = str_replace(',', '.', $item['StoreProduct']['price_detaliczna'])*$ilosc_typow;								
									$sum += $price;
								?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($price_detal,2,'','',$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange']);?></span> 
								<span class="product-view-price"><?php echo $this->Store->price($price,2,null,null,$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange'])?></span>
								 
						<?php }else if( $item['StoreProduct']['price_promocja'] > 0){?>
								<?php
									$price = str_replace(',', '.', $item['StoreProduct']['price_promocja']) * $ilosc_typow;	
									$price_detal = str_replace(',', '.', $item['StoreProduct']['price_detaliczna'])*$ilosc_typow;								
									$sum += $price;
								?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($price_detal,2,'','',$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange']);?></span> 
								<span class="product-view-price"><?php echo $this->Store->price($price,2,null,null,$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange'])?></span>
		
						<?php }else{?>
								<?php
									$price = str_replace(',', '.', $item['StoreProduct']['price_detaliczna']) * $ilosc_typow;									
									$sum += $price;
								?>
								<span class="product-view-price"><?php echo $this->Store->price($price,2,null,null,$item['StoreProduct']['currency_id'],$item['StoreCurrency']['exchange'])?></span>

						<?php }?>
					</td>
				</tr>
			<?php endforeach; ?>
				<tr<?php echo $style_class;?>>
					<td colspan="6" align="right" width="100%" class="actions total-cart">
					
						<?php echo __d("store","Total: ")?><span class="product-view-price"><?php echo $this->Store->price($sum,2,null,null,$this->Session->read('Store.selected_currency'),$this->Session->read('Store.selected_exchange'))?></span>
					</td>
				</tr>
				<tr>
					<td colspan="6">

					Delivery:
						
					</td>
				</tr>				
			</table>
					
			<div class="clr"></div>	
					<input type="hidden" name="VPSProtocol" value="<?php  echo $strProtocol ?>"/>
					<input type="hidden" name="TxType" value="<?php  echo $strTransactionType ?>"/>
					<input type="hidden" name="Vendor" value="<?php  echo $strVendorName ?>"/>
					<input type="hidden" name="Crypt" value="<?php echo $strCrypt?>"/>

			<?php echo $html->link(__d("store","Go back to the customer details page",true),array('plugin'=>'store','controller'=>'carts','action'=>'cart_customer'),array('class'=>'button float-left corners-4'))?>
			<input type="image" src="/img/store.moon/buttons_proceed_to_payment.png" style="border: none; padding: 0px; margin: 4px;" />
			<?php echo $this->Form->end()?>
			
		<?php }else{?>
			<?php echo $this->Section->generate(1);?>
		<?php }?>
	</div>
	</div>
	<div class="clr"></div>
</div>
<div class="clr"></div>		

